///////////////////////////////////////////////////////////
// 
//  MyOozeBall.h
// 
//  Authors:  Jeremy Bennett
//
///////////////////////////////////////////////////////////

#ifndef _MYOOZEBALL_H_ 
#define _MYOOZEBALL_H_

// Local Includes
#include "MySphere.h"

// SDL Includes

// Bullet Includes
#include <BulletDynamics\ConstraintSolver\btPoint2PointConstraint.h>

// System Includes

// Forward Declarations
class MyContext;
class btCollisionWorld;

class MyOozeBall : public MySphere
{
  public:
    MyOozeBall( const btScalar   fRadius,
                const btVector3 &vOrigin, 
                const btScalar   fMass=1.0f );
    ~MyOozeBall();

    void setHappiness( int i )         { _iHappiness    = i; }

    int id()                { return _iID; }

    int   happiness()       { return _iHappiness; }

    int factor( int i ) { return _iFactors[i]; }

    virtual bool render( MyContext *ctx );

    bool findNeighbors( btCollisionWorld *pWorld );

    int compatibility( const MyOozeBall *pBall );

    void setSearchAng( int iAng )
      { _iSearchAng = iAng; }
    void setFactors( int *pFac ) 
      { memcpy( _iFactors, pFac, 5*sizeof(int) ); }

  protected:
    
    void _updateSearchAngle();

    //
    int                         _iID;
    
    //
    enum { max_factors=5 } happiness_factors;
    int                         _iFactors[max_factors];

    // Happiness
    int                         _iHappiness;

    // Search 
    bool                        _bSearchHit;
    int                         _iSearchAng;
    btVector3                   _vSearchVec;
    btVector3                   _vSearchMov;
};

#endif //_MyOozeBall_H_